import pandas as pd
df1 = pd.read_csv(r'C:\Users\Wang\Desktop\data\stock_small.csv')
df = df1.iloc[:, [ 1, 2, 8]]#<股票代码><年月日> <调整后收盘价>
df['date'] = pd.to_datetime(df['date'])
df['date.y'] = df['date'].dt.year
data=df[df['stock_symbol']== 'AAPL']
grouped=data.groupby('date.y').mean()['stock_price_adj_close']
df2=pd.DataFrame(grouped)
df2.columns=['年平均调整后收盘价']
df2.reset_index(inplace=True)
print(df2[df2['年平均调整后收盘价']>=50])




